﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace DukeySoundHelper
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            CheckRunning();
        }
        private static void CheckRunning()
        {
            int ProceedingCount = 0;
            System.Diagnostics.Process[] Processes;
            Processes = System.Diagnostics.Process.GetProcessesByName("DukeyVoice");

            foreach (System.Diagnostics.Process IsProcedding in Processes)
            {
                if (IsProcedding.ProcessName.Trim() == "DukeyVoice".Trim())
                {
                    ProceedingCount += 1;
                }
            }
            if (ProceedingCount > 1)
            {
                DialogResult result;
                result = MessageBox.Show("Appliction is running!", "DukeyVoice", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //foreach (System.Diagnostics.Process myProcess in Processes)
                //{
                //    myProcess.Kill();
                //}
            }
            else
            {
                Application.Run(new MainFrm());
            }
        }
    }
}
